package org.fiel.torque;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.Torque;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;



                                                  

/**
 * You should not use this class directly.  It should not even be
 * extended all references should be to Informacion
 */
public abstract class BaseInformacion extends BaseObject
{
    /** The Peer class */
    private static final InformacionPeer peer =
        new InformacionPeer();

        
    /** The value for the id field */
    private Short id;
      
    /** The value for the nombreArchivo field */
    private String nombreArchivo;
      
    /** The value for the fileName field */
    private String fileName;
      
    /** The value for the titulo field */
    private String titulo;
      
    /** The value for the title field */
    private String title;
      
    /** The value for the imagen field */
    private String imagen;
      
    /** The value for the nivel field */
    private String nivel;
      
    /** The value for the formato field */
    private String formato;
      
    /** The value for the fechaE field */
    private Date fechaE;
      
    /** The value for the fechaP field */
    private Date fechaP;
      
    /** The value for the abstracto field */
    private byte[] abstracto;
      
    /** The value for the abstractoE field */
    private byte[] abstractoE;
      
    /** The value for the costo field */
    private String costo;
      
    /** The value for the cost field */
    private String cost;
      
    /** The value for the tiempo field */
    private int tiempo;
      
    /** The value for the tipoId field */
    private Integer tipoId;
      
    /** The value for the subtipoId field */
    private Integer subtipoId;
  
            
    /**
     * Get the Id
     *
     * @return Short
     */
    public Short getId()
    {
        return id;
    }

        
    /**
     * Set the value of Id
     *
     * @param v new value
     */
    public void setId(Short v) 
    {
    
                  if (!ObjectUtils.equals(this.id, v))
              {
            this.id = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the NombreArchivo
     *
     * @return String
     */
    public String getNombreArchivo()
    {
        return nombreArchivo;
    }

        
    /**
     * Set the value of NombreArchivo
     *
     * @param v new value
     */
    public void setNombreArchivo(String v) 
    {
    
                  if (!ObjectUtils.equals(this.nombreArchivo, v))
              {
            this.nombreArchivo = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the FileName
     *
     * @return String
     */
    public String getFileName()
    {
        return fileName;
    }

        
    /**
     * Set the value of FileName
     *
     * @param v new value
     */
    public void setFileName(String v) 
    {
    
                  if (!ObjectUtils.equals(this.fileName, v))
              {
            this.fileName = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Titulo
     *
     * @return String
     */
    public String getTitulo()
    {
        return titulo;
    }

        
    /**
     * Set the value of Titulo
     *
     * @param v new value
     */
    public void setTitulo(String v) 
    {
    
                  if (!ObjectUtils.equals(this.titulo, v))
              {
            this.titulo = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Title
     *
     * @return String
     */
    public String getTitle()
    {
        return title;
    }

        
    /**
     * Set the value of Title
     *
     * @param v new value
     */
    public void setTitle(String v) 
    {
    
                  if (!ObjectUtils.equals(this.title, v))
              {
            this.title = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Imagen
     *
     * @return String
     */
    public String getImagen()
    {
        return imagen;
    }

        
    /**
     * Set the value of Imagen
     *
     * @param v new value
     */
    public void setImagen(String v) 
    {
    
                  if (!ObjectUtils.equals(this.imagen, v))
              {
            this.imagen = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Nivel
     *
     * @return String
     */
    public String getNivel()
    {
        return nivel;
    }

        
    /**
     * Set the value of Nivel
     *
     * @param v new value
     */
    public void setNivel(String v) 
    {
    
                  if (!ObjectUtils.equals(this.nivel, v))
              {
            this.nivel = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Formato
     *
     * @return String
     */
    public String getFormato()
    {
        return formato;
    }

        
    /**
     * Set the value of Formato
     *
     * @param v new value
     */
    public void setFormato(String v) 
    {
    
                  if (!ObjectUtils.equals(this.formato, v))
              {
            this.formato = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the FechaE
     *
     * @return Date
     */
    public Date getFechaE()
    {
        return fechaE;
    }

        
    /**
     * Set the value of FechaE
     *
     * @param v new value
     */
    public void setFechaE(Date v) 
    {
    
                  if (!ObjectUtils.equals(this.fechaE, v))
              {
            this.fechaE = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the FechaP
     *
     * @return Date
     */
    public Date getFechaP()
    {
        return fechaP;
    }

        
    /**
     * Set the value of FechaP
     *
     * @param v new value
     */
    public void setFechaP(Date v) 
    {
    
                  if (!ObjectUtils.equals(this.fechaP, v))
              {
            this.fechaP = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Abstracto
     *
     * @return byte[]
     */
    public byte[] getAbstracto()
    {
        return abstracto;
    }

        
    /**
     * Set the value of Abstracto
     *
     * @param v new value
     */
    public void setAbstracto(byte[] v) 
    {
    
                  if (!ObjectUtils.equals(this.abstracto, v))
              {
            this.abstracto = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the AbstractoE
     *
     * @return byte[]
     */
    public byte[] getAbstractoE()
    {
        return abstractoE;
    }

        
    /**
     * Set the value of AbstractoE
     *
     * @param v new value
     */
    public void setAbstractoE(byte[] v) 
    {
    
                  if (!ObjectUtils.equals(this.abstractoE, v))
              {
            this.abstractoE = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Costo
     *
     * @return String
     */
    public String getCosto()
    {
        return costo;
    }

        
    /**
     * Set the value of Costo
     *
     * @param v new value
     */
    public void setCosto(String v) 
    {
    
                  if (!ObjectUtils.equals(this.costo, v))
              {
            this.costo = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Cost
     *
     * @return String
     */
    public String getCost()
    {
        return cost;
    }

        
    /**
     * Set the value of Cost
     *
     * @param v new value
     */
    public void setCost(String v) 
    {
    
                  if (!ObjectUtils.equals(this.cost, v))
              {
            this.cost = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the Tiempo
     *
     * @return int
     */
    public int getTiempo()
    {
        return tiempo;
    }

        
    /**
     * Set the value of Tiempo
     *
     * @param v new value
     */
    public void setTiempo(int v) 
    {
    
                  if (this.tiempo != v)
              {
            this.tiempo = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the TipoId
     *
     * @return Integer
     */
    public Integer getTipoId()
    {
        return tipoId;
    }

        
    /**
     * Set the value of TipoId
     *
     * @param v new value
     */
    public void setTipoId(Integer v) 
    {
    
                  if (!ObjectUtils.equals(this.tipoId, v))
              {
            this.tipoId = v;
            setModified(true);
        }
    
        }
          
    /**
     * Get the SubtipoId
     *
     * @return Integer
     */
    public Integer getSubtipoId()
    {
        return subtipoId;
    }

        
    /**
     * Set the value of SubtipoId
     *
     * @param v new value
     */
    public void setSubtipoId(Integer v) 
    {
    
                  if (!ObjectUtils.equals(this.subtipoId, v))
              {
            this.subtipoId = v;
            setModified(true);
        }
    
        }
  
    
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          if (isModified())
        {
            if (isNew())
            {
                InformacionPeer.doInsert((Informacion) this);
                setNew(false);
            }
            else
            {
                InformacionPeer.doUpdate((Informacion) this);
            }
        }
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          if (isModified())
        {
            try
            {
                con = Torque.getConnection(dbName);
                if (isNew())
                {
                    InformacionPeer
                        .doInsert((Informacion) this, con);
                    setNew(false);
                }
                else
                {
                    InformacionPeer
                        .doUpdate((Informacion) this, con);
                }
            }
            finally
            {
                Torque.closeConnection(con);
            }
        }
      }

      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    InformacionPeer.doInsert((Informacion) this, con);
                    setNew(false);
                }
                else
                {
                    InformacionPeer.doUpdate((Informacion) this, con);
                }
                }

        }

        
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param key id ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        
    {
            setId(new Short(((NumberKey) key).shortValue()));
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) 
    {
            setId(new Short(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getId());
      }
 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       */
      public Informacion copy() throws TorqueException
    {
        return copyInto(new Informacion());
    }
  
    protected Informacion copyInto(Informacion copyObj) throws TorqueException
    {
          copyObj.setId(id);
          copyObj.setNombreArchivo(nombreArchivo);
          copyObj.setFileName(fileName);
          copyObj.setTitulo(titulo);
          copyObj.setTitle(title);
          copyObj.setImagen(imagen);
          copyObj.setNivel(nivel);
          copyObj.setFormato(formato);
          copyObj.setFechaE(fechaE);
          copyObj.setFechaP(fechaP);
          copyObj.setAbstracto(abstracto);
          copyObj.setAbstractoE(abstractoE);
          copyObj.setCosto(costo);
          copyObj.setCost(cost);
          copyObj.setTiempo(tiempo);
          copyObj.setTipoId(tipoId);
          copyObj.setSubtipoId(subtipoId);
  
                    copyObj.setId((Short)null);
                                                                                                            
          return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public InformacionPeer getPeer()
    {
        return peer;
    }


    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Informacion:\n");
        str.append("Id = ")
               .append(getId())
             .append("\n");
        str.append("NombreArchivo = ")
               .append(getNombreArchivo())
             .append("\n");
        str.append("FileName = ")
               .append(getFileName())
             .append("\n");
        str.append("Titulo = ")
               .append(getTitulo())
             .append("\n");
        str.append("Title = ")
               .append(getTitle())
             .append("\n");
        str.append("Imagen = ")
               .append(getImagen())
             .append("\n");
        str.append("Nivel = ")
               .append(getNivel())
             .append("\n");
        str.append("Formato = ")
               .append(getFormato())
             .append("\n");
        str.append("FechaE = ")
               .append(getFechaE())
             .append("\n");
        str.append("FechaP = ")
               .append(getFechaP())
             .append("\n");
        str.append("Abstracto = ")
               .append("<binary>")
             .append("\n");
        str.append("AbstractoE = ")
               .append("<binary>")
             .append("\n");
        str.append("Costo = ")
               .append(getCosto())
             .append("\n");
        str.append("Cost = ")
               .append(getCost())
             .append("\n");
        str.append("Tiempo = ")
               .append(getTiempo())
             .append("\n");
        str.append("TipoId = ")
               .append(getTipoId())
             .append("\n");
        str.append("SubtipoId = ")
               .append(getSubtipoId())
             .append("\n");
        return(str.toString());
    }
}
